home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / benchmarks / itc / cc1.spur / emit-rtl.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-08-30  |  36.2 KB  |  1,480 lines

  1. /* Emit RTL for the GNU C-Compiler expander.
  2.    Copyright (C) 1987, 1988 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU CC.
  5.  
  6. GNU CC is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY.  No author or distributor
  8. accepts responsibility to anyone for the consequences of using it
  9. or for whether it serves any particular purpose or works at all,
  10. unless he says so in writing.  Refer to the GNU CC General Public
  11. License for full details.
  12.  
  13. Everyone is granted permission to copy, modify and redistribute
  14. GNU CC, but only under the conditions described in the
  15. GNU CC General Public License.   A copy of this license is
  16. supposed to have been given to you along with GNU CC so you
  17. can know your rights and responsibilities.  It should be in a
  18. file named COPYING.  Among other things, the copyright notice
  19. and this notice must be preserved on all copies.  */
  20.  
  21.  
  22. /* Middle-to-low level generation of rtx code and insns.
  23.  
  24.    This file contains the functions `gen_rtx', `gen_reg_rtx'
  25.    and `gen_label_rtx' that are the usual ways of creating rtl
  26.    expressions for most purposes.
  27.  
  28.    It also has the functions for creating insns and linking
  29.    them in the doubly-linked chain.
  30.  
  31.    The patterns of the insns are created by machine-dependent
  32.    routines in insn-emit.c, which is generated automatically from
  33.    the machine description.  These routines use `gen_rtx' to make
  34.    the individual rtx's of the pattern; what is machine dependent
  35.    is the kind of rtx's they make and what arguments they use.  */
  36.  
  37. #include "config.h"
  38. #include <stdio.h>
  39. #include "varargs.h"
  40. #include "rtl.h"
  41. #include "regs.h"
  42. #include "insn-config.h"
  43. #include "alloca.h"
  44.  
  45. #define max(A,B) ((A) > (B) ? (A) : (B))
  46. #define min(A,B) ((A) < (B) ? (A) : (B))
  47.  
  48. /* This is reset to FIRST_PSEUDO_REGISTER at the start each function.
  49.    After rtl generation, it is 1 plus the largest register number used.  */
  50.  
  51. int reg_rtx_no = FIRST_PSEUDO_REGISTER;
  52.  
  53. /* This is *not* reset after each function.  It gives each CODE_LABEL
  54.    in the entire compilation a unique label number.  */
  55.  
  56. static int label_num = 1;
  57.  
  58. /* Value of `label_num' at start of current function.  */
  59.  
  60. static int first_label_num;
  61.  
  62. /* Nonzero means do not generate NOTEs for source line numbers.  */
  63.  
  64. static int no_line_numbers;
  65.  
  66. /* Commonly used rtx's, so that we only need space for one copy.
  67.    These are initialized once for the entire compilation.
  68.    All of these except perhaps fconst0_rtx and dconst0_rtx
  69.    are unique; no other rtx-object will be equal to any of these.  */
  70.  
  71. rtx pc_rtx;            /* (PC) */
  72. rtx cc0_rtx;            /* (CC0) */
  73. rtx cc1_rtx;            /* (CC1) (not actually used nowadays) */
  74. rtx const0_rtx;            /* (CONST_INT 0) */
  75. rtx const1_rtx;            /* (CONST_INT 1) */
  76. rtx fconst0_rtx;        /* (CONST_DOUBLE:SF 0) */
  77. rtx dconst0_rtx;        /* (CONST_DOUBLE:DF 0) */
  78.  
  79. /* All references to the following fixed hard registers go through
  80.    these unique rtl objects.  On machines where the frame-pointer and
  81.    arg-pointer are the same register, they use the same unique object.
  82.  
  83.    After register allocation, other rtl objects which used to be pseudo-regs
  84.    may be clobbered to refer to the frame-pointer register.
  85.    But references that were originally to the frame-pointer can be
  86.    distinguished from the others because they contain frame_pointer_rtx.
  87.  
  88.    In an inline procedure, the stack and frame pointer rtxs may not be
  89.    used for anything else.  */
  90. rtx stack_pointer_rtx;        /* (REG:Pmode STACK_POINTER_REGNUM) */
  91. rtx frame_pointer_rtx;        /* (REG:Pmode FRAME_POINTER_REGNUM) */
  92. rtx arg_pointer_rtx;        /* (REG:Pmode ARG_POINTER_REGNUM) */
  93. rtx struct_value_rtx;        /* (REG:Pmode STRUCT_VALUE_REGNUM) */
  94. rtx struct_value_incoming_rtx;    /* (REG:Pmode STRUCT_VALUE_INCOMING_REGNUM) */
  95. rtx static_chain_rtx;        /* (REG:Pmode STATIC_CHAIN_REGNUM) */
  96. rtx static_chain_incoming_rtx;    /* (REG:Pmode STATIC_CHAIN_INCOMING_REGNUM) */
  97.  
  98. /* The ends of the doubly-linked chain of rtl for the current function.
  99.    Both are reset to null at the start of rtl generation for the function.  */
  100.  
  101. static rtx first_insn = NULL;
  102. static rtx last_insn = NULL;
  103.  
  104. /* The ends of a similar chain of rtl insns to become part
  105.    of the SEQUENCE returned by a gen_... function (in insn-emit.c).
  106.    This allows define_expand to use subroutines that call emit_insn.  */
  107. static rtx sequence_first_insn = NULL;
  108. static rtx sequence_last_insn = NULL;
  109.  
  110. /* Nonzero if emit_insn should add to the sequence_first_insn chain
  111.    instead of the ordinary chain.  */
  112. int emit_to_sequence;
  113.  
  114. /* INSN_UID for next insn emitted.
  115.    Reset to 1 for each function compiled.  */
  116.  
  117. static int cur_insn_uid = 1;
  118.  
  119. /* Line number and source file of the last line-number NOTE emitted.
  120.    This is used to avoid generating duplicates.  */
  121.  
  122. static int last_linenum = 0;
  123. static char *last_filename = 0;
  124.  
  125. /* A vector indexed by pseudo reg number.  The allocated length
  126.    of this vector is regno_pointer_flag_length.  Since this
  127.    vector is needed during the expansion phase when the total
  128.    number of registers in the function is not yet known,
  129.    it is copied and made bigger when necessary.  */
  130.  
  131. char *regno_pointer_flag;
  132. int regno_pointer_flag_length;
  133.  
  134. /* Indexed by pseudo register number, gives the rtx for that pseudo.
  135.    Allocated in parallel with regno_pointer_flag.  */
  136.  
  137. rtx *regno_reg_rtx;
  138.  
  139. /* Chain of all CONST_DOUBLEs made for this function;
  140.    so we can uniquize them.  */
  141.  
  142. rtx real_constant_chain;
  143.  
  144. /* rtx gen_rtx (code, mode, [element1, ..., elementn])
  145. **
  146. **        This routine generates an RTX of the size specified by
  147. **    <code>, which is an RTX code.   The RTX structure is initialized
  148. **    from the arguments <element1> through <elementn>, which are
  149. **    interpreted according to the specific RTX type's format.   The
  150. **    special machine mode associated with the rtx (if any) is specified
  151. **    in <mode>.
  152. **
  153. **        gen_rtx() can be invoked in a way which resembles the lisp-like
  154. **    rtx it will generate.   For example, the following rtx structure:
  155. **
  156. **          (plus:QI (mem:QI (reg:SI 1))
  157. **               (mem:QI (plusw:SI (reg:SI 2) (reg:SI 3))))
  158. **
  159. **        ...would be generated by the following C code:
  160. **
  161. **            gen_rtx (PLUS, QImode,
  162. **            gen_rtx (MEM, QImode,
  163. **            gen_rtx (REG, SImode, 1)),
  164. **            gen_rtx (MEM, QImode,
  165. **            gen_rtx (PLUS, SImode,
  166. **                gen_rtx (REG, SImode, 2),
  167. **                gen_rtx (REG, SImode, 3)))),
  168. */
  169.  
  170. /*VARARGS2*/
  171. rtx
  172. gen_rtx (va_alist)
  173.      va_dcl
  174. {
  175.   va_list p;
  176.   enum rtx_code code;
  177.   enum machine_mode mode;
  178.   register char *argp;        /* Pointer to arguments...        */
  179.   register int i;        /* Array indices...            */
  180.   register char *fmt;        /* Current rtx's format...        */
  181.   register rtx rt_val;        /* RTX to return to caller...        */
  182.  
  183.   va_start (p);
  184.   code = va_arg (p, enum rtx_code);
  185.   mode = va_arg (p, enum machine_mode);
  186.  
  187.   if (code == CONST_INT)
  188.     {
  189.       int arg = va_arg (p, int);
  190.       if (arg == 0)
  191.     return const0_rtx;
  192.       if (arg == 1)
  193.     return const1_rtx;
  194.       rt_val = rtx_alloc (code);
  195.       INTVAL (rt_val) = arg;
  196.     }
  197.   else if (code == CONST_DOUBLE)
  198.     {
  199.       int arg0 = va_arg (p, int);
  200.       int arg1 = va_arg (p, int);
  201.       if (arg0 == XINT (fconst0_rtx, 0)
  202.       && arg1 == XINT (fconst0_rtx, 1))
  203.     return (mode == DFmode ? dconst0_rtx : fconst0_rtx);
  204.       rt_val = rtx_alloc (code);
  205.       rt_val->mode = mode;
  206.       XINT (rt_val, 0) = arg0;
  207.       XINT (rt_val, 1) = arg1;
  208.     }
  209.   else
  210.     {
  211.       rt_val = rtx_alloc (code);    /* Allocate the storage space.  */
  212.       rt_val->mode = mode;        /* Store the machine mode...  */
  213.  
  214.       fmt = GET_RTX_FORMAT (code);    /* Find the right format...  */
  215.       for (i = 0; i < GET_RTX_LENGTH (code); i++)
  216.     {
  217.       switch (*fmt++)
  218.         {
  219.         case '0':        /* Unused field.  */
  220.           break;
  221.  
  222.         case 'i':        /* An integer?  */
  223.           XINT (rt_val, i) = va_arg (p, int);
  224.           break;
  225.  
  226.         case 's':        /* A string?  */
  227.           XSTR (rt_val, i) = va_arg (p, char *);
  228.           break;
  229.  
  230.         case 'e':        /* An expression?  */
  231.         case 'u':        /* An insn?  Same except when printing.  */
  232.           XEXP (rt_val, i) = va_arg (p, rtx);
  233.           break;
  234.  
  235.         case 'E':        /* An RTX vector?  */
  236.           XVEC (rt_val, i) = va_arg (p, rtvec);
  237.           break;
  238.  
  239.         default:
  240.           abort();
  241.         }
  242.     }
  243.     }
  244.   va_end (p);
  245.   return rt_val;        /* Return the new RTX...        */
  246. }
  247.  
  248. /* gen_rtvec (n, [rt1, ..., rtn])
  249. **
  250. **        This routine creates an rtvec and stores within it the
  251. **    pointers to rtx's which are its arguments.
  252. */
  253.  
  254. /*VARARGS1*/
  255. rtvec
  256. gen_rtvec (va_alist)
  257.      va_dcl
  258. {
  259.   int n, i;
  260.   rtx first;
  261.   va_list p;
  262.   rtx *vector;
  263.  
  264.   va_start (p);
  265.   n = va_arg (p, int);
  266.  
  267.   if (n == 0)
  268.     return NULL_RTVEC;        /* Don't allocate an empty rtvec...    */
  269.  
  270.   vector = (rtx *) alloca (n * sizeof (rtx));
  271.   for (i = 0; i < n; i++)
  272.     vector[i] = va_arg (p, rtx);
  273.   va_end (p);
  274.  
  275.   return gen_rtvec_v (n, vector);
  276. }
  277.  
  278. rtvec
  279. gen_rtvec_v (n, argp)
  280.      int n;
  281.      rtx *argp;
  282. {
  283.   register int i;
  284.   register rtvec rt_val;
  285.  
  286.   if (n == 0)
  287.     return NULL_RTVEC;        /* Don't allocate an empty rtvec...    */
  288.  
  289.   rt_val = rtvec_alloc (n);    /* Allocate an rtvec...            */
  290.  
  291.   for (i = 0; i < n; i++)
  292.     rt_val->elem[i].rtx = *argp++;
  293.  
  294.   return rt_val;
  295. }
  296.  
  297. /* Generate a REG rtx for a new pseudo register of mode MODE.
  298.    This pseudo is assigned the next sequential register number.  */
  299.  
  300. rtx
  301. gen_reg_rtx (mode)
  302.      enum machine_mode mode;
  303. {
  304.   register rtx val;
  305.  
  306.   /* Make sure regno_pointer_flag and regno_reg_rtx are large
  307.      enough to have an element for this pseudo reg number.  */
  308.  
  309.   if (reg_rtx_no == regno_pointer_flag_length)
  310.     {
  311.       rtx *new1;
  312.       char *new =
  313.     (char *) oballoc (regno_pointer_flag_length * 2);
  314.       bzero (new, regno_pointer_flag_length * 2);
  315.       bcopy (regno_pointer_flag, new, regno_pointer_flag_length);
  316.       regno_pointer_flag = new;
  317.  
  318.       new1 = (rtx *) oballoc (regno_pointer_flag_length * 2 * sizeof (rtx));
  319.       bzero (new1, regno_pointer_flag_length * 2 * sizeof (rtx));
  320.       bcopy (regno_reg_rtx, new1, regno_pointer_flag_length * sizeof (rtx));
  321.       regno_reg_rtx = new1;
  322.  
  323.       regno_pointer_flag_length *= 2;
  324.     }
  325.  
  326.   val = gen_rtx (REG, mode, reg_rtx_no);
  327.   regno_reg_rtx[reg_rtx_no++] = val;
  328.   return val;
  329. }
  330.  
  331. /* Identify REG as a probable pointer register.  */
  332.  
  333. void
  334. mark_reg_pointer (reg)
  335.      rtx reg;
  336. {
  337.   REGNO_POINTER_FLAG (REGNO (reg)) = 1;
  338. }
  339.  
  340. /* Return 1 plus largest pseudo reg number used in the current function.  */
  341.  
  342. int
  343. max_reg_num ()
  344. {
  345.   return reg_rtx_no;
  346. }
  347.  
  348. /* Return 1 + the largest label number used so far.  */
  349.  
  350. int
  351. max_label_num ()
  352. {
  353.   return label_num;
  354. }
  355.  
  356. /* Return first label number used in this function (if any were used).  */
  357.  
  358. int
  359. get_first_label_num ()
  360. {
  361.   return first_label_num;
  362. }
  363.  
  364. /* Assuming that X is an rtx (MEM, REG or SUBREG) for a fixed-point number,
  365.    return a MEM or SUBREG rtx that refers to the least-significant part of X.
  366.    MODE specifies how big a part of X to return;
  367.    it must not be larger than a word.
  368.    If X is a MEM whose address is a QUEUED, the value may be so also.  */
  369.  
  370. rtx
  371. gen_lowpart (mode, x)
  372.      enum machine_mode mode;
  373.      register rtx x;
  374. {
  375.   /* This case loses if X is a subreg.  To catch bugs early,
  376.      complain if an invalid MODE is used even in other cases.  */
  377.   if (GET_MODE_SIZE (mode) > UNITS_PER_WORD)
  378.     abort ();
  379.   if (GET_CODE (x) == SUBREG)
  380.     return (GET_MODE (SUBREG_REG (x)) == mode && SUBREG_WORD (x) == 0
  381.         ? SUBREG_REG (x)
  382.         : gen_rtx (SUBREG, mode, SUBREG_REG (x), SUBREG_WORD (x)));
  383.   if (GET_MODE (x) == mode)
  384.     return x;
  385.   if (GET_CODE (x) == CONST_INT)
  386.     return gen_rtx (CONST_INT, VOIDmode, INTVAL (x) & GET_MODE_MASK (mode));
  387.   if (GET_CODE (x) == MEM)
  388.     {
  389.       register int offset = 0;
  390. #ifdef WORDS_BIG_ENDIAN
  391.       offset = (max (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD)
  392.         - max (GET_MODE_SIZE (mode), UNITS_PER_WORD));
  393. #endif
  394. #ifdef BYTES_BIG_ENDIAN
  395.       /* Adjust the address so that the address-after-the-data
  396.      is unchanged.  */
  397.       offset -= (min (UNITS_PER_WORD, GET_MODE_SIZE (mode))
  398.          - min (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (x))));
  399. #endif
  400.       return gen_rtx (MEM, mode,
  401.               memory_address (mode,
  402.                       plus_constant (XEXP (x, 0), offset)));
  403.     }
  404.   else if (GET_CODE (x) == REG)
  405.     {
  406. #ifdef WORDS_BIG_ENDIAN
  407.       if (GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
  408.     {
  409.       return gen_rtx (SUBREG, mode, x,
  410.               ((GET_MODE_SIZE (GET_MODE (x))
  411.                 - max (GET_MODE_SIZE (mode), UNITS_PER_WORD))
  412.                / UNITS_PER_WORD));
  413.     }
  414. #endif
  415.       return gen_rtx (SUBREG, mode, x, 0);
  416.     }
  417.   else
  418.     abort ();
  419. }
  420.  
  421. /* Like `gen_lowpart', but refer to the most significant part.  */
  422.  
  423. rtx
  424. gen_highpart (mode, x)
  425.      enum machine_mode mode;
  426.      register rtx x;
  427. {
  428.   if (GET_CODE (x) == MEM)
  429.     {
  430.       register int offset = 0;
  431. #ifndef WORDS_BIG_ENDIAN
  432.       offset = (max (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD)
  433.         - max (GET_MODE_SIZE (mode), UNITS_PER_WORD));
  434. #endif
  435. #ifndef BYTES_BIG_ENDIAN
  436.       if (GET_MODE_SIZE (mode) < UNITS_PER_WORD)
  437.     offset -= (GET_MODE_SIZE (mode)
  438.            - min (UNITS_PER_WORD,
  439.               GET_MODE_SIZE (GET_MODE (x))));
  440. #endif
  441.       return gen_rtx (MEM, mode,
  442.               memory_address (mode,
  443.                       plus_constant (XEXP (x, 0), offset)));
  444.     }
  445.   else if (GET_CODE (x) == REG)
  446.     {
  447. #ifndef WORDS_BIG_ENDIAN
  448.       if (GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
  449.     {
  450.       return gen_rtx (SUBREG, mode, x,
  451.               ((GET_MODE_SIZE (GET_MODE (x))
  452.                 - max (GET_MODE_SIZE (mode), UNITS_PER_WORD))
  453.                / UNITS_PER_WORD));
  454.     }
  455. #endif
  456.       return gen_rtx (SUBREG, mode, x, 0);
  457.     }
  458.   else
  459.     abort ();
  460. }
  461.  
  462. /* Return 1 iff X, assumed to be a SUBREG,
  463.    refers to the least significant part of its containing reg.
  464.    If X is not a SUBREG, always return 1 (it is its own low part!).  */
  465.  
  466. int
  467. subreg_lowpart_p (x)
  468.      rtx x;
  469. {
  470.   if (GET_CODE (x) != SUBREG)
  471.     return 1;
  472. #ifdef WORDS_BIG_ENDIAN
  473.   if (GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
  474.     {
  475.       register enum machine_mode mode = GET_MODE (SUBREG_REG (x));
  476.       return (SUBREG_WORD (x)
  477.           == ((GET_MODE_SIZE (GET_MODE (x))
  478.            - max (GET_MODE_SIZE (mode), UNITS_PER_WORD))
  479.           / UNITS_PER_WORD));
  480.     }
  481. #endif 
  482.   return SUBREG_WORD (x) == 0;
  483. }
  484.  
  485. /* Return a memory reference like MEMREF, but with its mode changed
  486.    to MODE and its address changed to ADDR.
  487.    (VOIDmode means don't change the mode.
  488.    NULL for ADDR means don't change the address.)  */
  489.  
  490. rtx
  491. change_address (memref, mode, addr)
  492.      rtx memref;
  493.      enum machine_mode mode;
  494.      rtx addr;
  495. {
  496.   rtx new;
  497.  
  498.   if (mode == VOIDmode)
  499.     mode = GET_MODE (memref);
  500.   if (addr == 0)
  501.     addr = XEXP (memref, 0);
  502.  
  503.   new = gen_rtx (MEM, mode, memory_address (mode, addr));
  504.   new->volatil = memref->volatil;
  505.   new->unchanging = memref->unchanging;
  506.   new->in_struct = memref->in_struct;
  507.   return new;
  508. }
  509.  
  510. /* Return a newly created CODE_LABEL rtx with a unique label number.  */
  511.  
  512. rtx
  513. gen_label_rtx ()
  514. {
  515.   register rtx label = gen_rtx (CODE_LABEL, VOIDmode, 0, 0, 0, label_num++);
  516.   LABEL_NUSES (label) = 0;
  517.   return label;
  518. }
  519.  
  520. /* For procedure integration.  */
  521.  
  522. /* Return a newly created INLINE_HEADER rtx.  Should allocate this
  523.    from a permanent obstack when the opportunity arises.  */
  524.  
  525. rtx
  526. gen_inline_header_rtx (insn, last_insn,
  527.                first_labelno, last_labelno,
  528.                max_parm_regnum, max_regnum, args_size)
  529.      rtx insn, last_insn;
  530.      int first_labelno, last_labelno, max_parm_regnum, max_regnum, args_size;
  531. {
  532.   rtx header = gen_rtx (INLINE_HEADER, VOIDmode,
  533.             cur_insn_uid++, NULL,
  534.             insn, last_insn,
  535.             first_labelno, last_labelno,
  536.             max_parm_regnum, max_regnum, args_size);
  537.   return header;
  538. }
  539.  
  540. /* Install new pointers to the first and last insns in the chain.
  541.    Used for an inline-procedure after copying the insn chain.  */
  542.  
  543. void
  544. set_new_first_and_last_insn (first, last)
  545.      rtx first, last;
  546. {
  547.   first_insn = first;
  548.   last_insn = last;
  549. }
  550.  
  551. /* Go through all the RTL insn bodies and copy any invalid shared structure.
  552.    It does not work to do this twice, because the mark bits set here
  553.    are not cleared afterwards.  */
  554.  
  555. static int unshare_copies = 0;    /* Count rtx's that were copied.  */
  556.  
  557. static rtx copy_rtx_if_shared ();
  558.  
  559. void
  560. unshare_all_rtl (insn)
  561.      register rtx insn;
  562. {
  563.   for (; insn; insn = NEXT_INSN (insn))
  564.     if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN
  565.     || GET_CODE (insn) == CALL_INSN)
  566.       {
  567.     rtx tail;
  568.     PATTERN (insn) = copy_rtx_if_shared (PATTERN (insn));
  569.     /* Copy the contents of the reg-notes */
  570.     for (tail = REG_NOTES (insn); tail; tail = XEXP (tail, 1))
  571.       /* But if contents are an insn, don't copy that.  */
  572.       if (GET_CODE (tail) == EXPR_LIST)
  573.         XEXP (tail, 0) = copy_rtx_if_shared (XEXP (tail, 0));
  574.       }
  575. }
  576.  
  577. /* Mark ORIG as in use, and return a copy of it if it was already in use.
  578.    Recursively does the same for subexpressions.  */
  579.  
  580. static rtx
  581. copy_rtx_if_shared (orig)
  582.      rtx orig;
  583. {
  584.   register rtx x = orig;
  585.   register int i;
  586.   register enum rtx_code code;
  587.   register char *format_ptr;
  588.   int copied = 0;
  589.  
  590.   code = GET_CODE (x);
  591.  
  592.   /* These types may be freely shared.  */
  593.  
  594.   switch (code)
  595.     {
  596.     case REG:
  597.     case QUEUED:
  598.     case CONST_INT:
  599.     case CONST_DOUBLE:
  600.     case SYMBOL_REF:
  601.     case CODE_LABEL:
  602.     case PC:
  603.     case CC0:
  604.       return x;
  605.  
  606.     case MEM:
  607.       /* A MEM is allowed to be shared if its address is constant
  608.      or is a constant plus one of the special registers.  */
  609.       if (CONSTANT_ADDRESS_P (XEXP (x, 0)))
  610.     return x;
  611.       if (GET_CODE (XEXP (x, 0)) == PLUS
  612.       && GET_CODE (XEXP (XEXP (x, 0), 0)) == REG
  613.       && (REGNO (XEXP (XEXP (x, 0), 0)) == FRAME_POINTER_REGNUM
  614.           || REGNO (XEXP (XEXP (x, 0), 0)) == ARG_POINTER_REGNUM)
  615.       && CONSTANT_ADDRESS_P (XEXP (XEXP (x, 0), 1)))
  616.       if (GET_CODE (XEXP (x, 0)) == REG
  617.       && (REGNO (XEXP (x, 0)) == FRAME_POINTER_REGNUM
  618.           || REGNO (XEXP (x, 0)) == ARG_POINTER_REGNUM)
  619.       && CONSTANT_ADDRESS_P (XEXP (x, 1)))
  620.     return x;
  621.     }
  622.  
  623.   /* This rtx may not be shared.  If it has already been seen,
  624.      replace it with a copy of itself.  */
  625.  
  626.   if (x->used)
  627.     {
  628.       register rtx copy;
  629.  
  630.       unshare_copies++;
  631.  
  632.       copy = rtx_alloc (code);
  633.       bcopy (x, copy, sizeof (int) * (GET_RTX_LENGTH (code) + 1));
  634.       x = copy;
  635.       copied = 1;
  636.     }
  637.   x->used = 1;
  638.  
  639.   /* Now scan the subexpressions recursively.
  640.      We can store any replaced subexpressions directly into X
  641.      since we know X is not shared!  Any vectors in X
  642.      must be copied if X was copied.  */
  643.  
  644.   format_ptr = GET_RTX_FORMAT (code);
  645.  
  646.   for (i = 0; i < GET_RTX_LENGTH (code); i++)
  647.     {
  648.       switch (*format_ptr++)
  649.     {
  650.     case 'e':
  651.       XEXP (x, i) = copy_rtx_if_shared (XEXP (x, i));
  652.       break;
  653.  
  654.     case 'E':
  655.       if (XVEC (x, i) != NULL)
  656.         {
  657.           register int j;
  658.  
  659.           if (copied)
  660.         XVEC (x, i) = gen_rtvec_v (XVECLEN (x, i), &XVECEXP (x, i, 0));
  661.           for (j = 0; j < XVECLEN (x, i); j++)
  662.         XVECEXP (x, i, j)
  663.           = copy_rtx_if_shared (XVECEXP (x, i, j));
  664.         }
  665.       break;
  666.     }
  667.     }
  668.   return x;
  669. }
  670.  
  671. /* Copy X if necessary so that it won't be altered by changes in OTHER.
  672.    Return X or the rtx for the pseudo reg the value of X was copied into.
  673.    OTHER must be valid as a SET_DEST.  */
  674.  
  675. rtx
  676. make_safe_from (x, other)
  677.      rtx x, other;
  678. {
  679.   rtx out = other;
  680.   while (1)
  681.     switch (GET_CODE (other))
  682.       {
  683.       case SUBREG:
  684.     other = SUBREG_REG (other);
  685.     break;
  686.       case STRICT_LOW_PART:
  687.       case SIGN_EXTEND:
  688.       case ZERO_EXTEND:
  689.     other = XEXP (other, 0);
  690.     break;
  691.       default:
  692.     goto done;
  693.       }
  694.  done:
  695.   if ((GET_CODE (other) == MEM
  696.        && ! CONSTANT_P (x)
  697.        && GET_CODE (x) != CONST_DOUBLE
  698.        && GET_CODE (x) != REG)
  699.       || (GET_CODE (other) == REG
  700.       && (REGNO (other) < FIRST_PSEUDO_REGISTER
  701.           || reg_mentioned_p (other, x))))
  702.     {
  703.       rtx temp = gen_reg_rtx (GET_MODE (x));
  704.       emit_move_insn (temp, x);
  705.       return temp;
  706.     }
  707.   return x;
  708. }
  709.  
  710. /* Emission of insns (adding them to the doubly-linked list).  */
  711.  
  712. /* Return the first insn of the current function.  */
  713.  
  714. rtx
  715. get_insns ()
  716. {
  717.   return first_insn;
  718. }
  719.  
  720. /* Return the last insn of the current function.  */
  721.  
  722. rtx
  723. get_last_insn ()
  724. {
  725.   return last_insn;
  726. }
  727.  
  728. /* Return a number larger than any instruction's uid in this function.  */
  729.  
  730. int
  731. get_max_uid ()
  732. {
  733.   return cur_insn_uid;
  734. }
  735.  
  736. /* Make and return an INSN rtx, initializing all its slots.
  737.    Store PATTERN in the pattern slots.
  738.    PAT_FORMALS is an idea that never really went anywhere.  */
  739.  
  740. static rtx
  741. make_insn_raw (pattern, pat_formals)
  742.      rtx pattern;
  743.      rtvec pat_formals;
  744. {
  745.   register rtx insn;
  746.  
  747.   insn = rtx_alloc(INSN);
  748.   INSN_UID(insn) = cur_insn_uid++;
  749.  
  750.   PATTERN (insn) = pattern;
  751.   INSN_CODE (insn) = -1;
  752.   LOG_LINKS(insn) = NULL;
  753.   REG_NOTES(insn) = NULL;
  754.  
  755.   return insn;
  756. }
  757.  
  758. /* Like `make_insn' but make a JUMP_INSN instead of an insn.  */
  759.  
  760. static rtx
  761. make_jump_insn_raw (pattern, pat_formals)
  762.      rtx pattern;
  763.      rtvec pat_formals;
  764. {
  765.   register rtx insn;
  766.  
  767.   insn = rtx_alloc(JUMP_INSN);
  768.   INSN_UID(insn) = cur_insn_uid++;
  769.  
  770.   PATTERN (insn) = pattern;
  771.   INSN_CODE (insn) = -1;
  772.   LOG_LINKS(insn) = NULL;
  773.   REG_NOTES(insn) = NULL;
  774.   JUMP_LABEL(insn) = NULL;
  775.  
  776.   return insn;
  777. }
  778.  
  779. /* Add INSN to the end of the doubly-linked list.
  780.    INSN may be an INSN, JUMP_INSN, CALL_INSN, CODE_LABEL, BARRIER or NOTE.  */
  781.  
  782. static void
  783. add_insn (insn)
  784.      register rtx insn;
  785. {
  786.   if (emit_to_sequence)
  787.     {
  788.       PREV_INSN (insn) = sequence_last_insn;
  789.       NEXT_INSN (insn) = 0;
  790.  
  791.       if (NULL != sequence_last_insn)
  792.     NEXT_INSN (sequence_last_insn) = insn;
  793.  
  794.       if (NULL == sequence_first_insn)
  795.     sequence_first_insn = insn;
  796.  
  797.       sequence_last_insn = insn;
  798.     }
  799.   else
  800.     {
  801.       PREV_INSN (insn) = last_insn;
  802.       NEXT_INSN (insn) = 0;
  803.  
  804.       if (NULL != last_insn)
  805.     NEXT_INSN (last_insn) = insn;
  806.  
  807.       if (NULL == first_insn)
  808.     first_insn = insn;
  809.  
  810.       last_insn = insn;
  811.     }
  812. }
  813.  
  814. /* Add INSN, an rtx of code INSN, into the doubly-linked list
  815.    after insn AFTER.  */
  816.  
  817. static void
  818. add_insn_after (insn, after)
  819.      rtx insn, after;
  820. {
  821.   NEXT_INSN (insn) = NEXT_INSN (after);
  822.   PREV_INSN (insn) = after;
  823.  
  824.   if (NEXT_INSN (insn))
  825.     PREV_INSN (NEXT_INSN (insn)) = insn;
  826.   else
  827.     last_insn = insn;
  828.   NEXT_INSN (after) = insn;
  829. }
  830.  
  831. /* Delete all insns made since FROM.
  832.    FROM becomes the new last instruction.  */
  833.  
  834. void
  835. delete_insns_since (from)
  836.      rtx from;
  837. {
  838.   NEXT_INSN (from) = 0;
  839.   last_insn = from;
  840. }
  841.  
  842. /* Move a consecutive bunch of insns to a different place in the chain.
  843.    The insns to be moved are those between FROM and TO.
  844.    They are moved to a new position after the insn AFTER.  */
  845.  
  846. void
  847. reorder_insns (from, to, after)
  848.      rtx from, to, after;
  849. {
  850.   /* Splice this bunch out of where it is now.  */
  851.   if (PREV_INSN (from))
  852.     NEXT_INSN (PREV_INSN (from)) = NEXT_INSN (to);
  853.   if (NEXT_INSN (to))
  854.     PREV_INSN (NEXT_INSN (to)) = PREV_INSN (from);
  855.   if (last_insn == to)
  856.     last_insn = PREV_INSN (from);
  857.   if (first_insn == from)
  858.     first_insn = NEXT_INSN (to);
  859.  
  860.   /* Make the new neighbors point to it and it to them.  */
  861.   if (NEXT_INSN (after))
  862.     {
  863.       PREV_INSN (NEXT_INSN (after)) = to;
  864.       NEXT_INSN (to) = NEXT_INSN (after);
  865.     }
  866.   PREV_INSN (from) = after;
  867.   NEXT_INSN (after) = from;
  868.   if (after == last_insn)
  869.     last_insn = to;
  870. }
  871.  
  872. /* Emit an insn of given code and pattern
  873.    at a specified place within the doubly-linked list.  */
  874.  
  875. /* Make an instruction with body PATTERN
  876.    and output it before the instruction BEFORE.  */
  877.  
  878. rtx
  879. emit_insn_before (pattern, before)
  880.      register rtx pattern, before;
  881. {
  882.   register rtx insn;
  883.  
  884.   if (GET_CODE (pattern) == SEQUENCE)
  885.     {
  886.       register int i;
  887.       /* For an empty sequence, emit nothing.  */
  888.       if (XVEC (pattern, 0))
  889.     for (i = 0; i < XVECLEN (pattern, 0); i++)
  890.       add_insn_after (XVECEXP (pattern, 0, i), PREV_INSN (before));
  891.       return PREV_INSN (before);
  892.     }
  893.  
  894.   insn = make_insn_raw (pattern, 0);
  895.  
  896.   PREV_INSN (insn) = PREV_INSN (before);
  897.   NEXT_INSN (insn) = before;
  898.  
  899.   if (PREV_INSN (insn))
  900.     NEXT_INSN (PREV_INSN (insn)) = insn;
  901.   else
  902.     first_insn = insn;
  903.   PREV_INSN (before) = insn;
  904.  
  905.   return insn;
  906. }
  907.  
  908. /* Make an instruction with body PATTERN and code JUMP_INSN
  909.    and output it before the instruction BEFORE.  */
  910.  
  911. rtx
  912. emit_jump_insn_before (pattern, before)
  913.      register rtx pattern, before;
  914. {
  915.   register rtx insn = make_jump_insn_raw (pattern, 0);
  916.  
  917.   PREV_INSN (insn) = PREV_INSN (before);
  918.   NEXT_INSN (insn) = before;
  919.  
  920.   if (PREV_INSN (insn))
  921.     NEXT_INSN (PREV_INSN (insn)) = insn;
  922.   else
  923.     first_insn = insn;
  924.   PREV_INSN (before) = insn;
  925.  
  926.   return insn;
  927. }
  928.  
  929. /* Make an insn of code INSN with body PATTERN
  930.    and output it after the insn AFTER.  */
  931.  
  932. rtx
  933. emit_insn_after (pattern, after)
  934.      register rtx pattern, after;
  935. {
  936.   if (GET_CODE (pattern) == SEQUENCE)
  937.     {
  938.       register int i;
  939.       /* For an empty sequence, emit nothing.  */
  940.       if (XVEC (pattern, 0))
  941.     for (i = 0; i < XVECLEN (pattern, 0); i++)
  942.       {
  943.         add_insn_after (XVECEXP (pattern, 0, i), after);
  944.         after = NEXT_INSN (after);
  945.       }
  946.       return after;
  947.     }
  948.   else
  949.     {
  950.       register rtx insn = make_insn_raw (pattern, 0);
  951.       add_insn_after (insn, after);
  952.       return insn;
  953.     }
  954. }
  955.  
  956. /* Make an insn of code JUMP_INSN with body PATTERN
  957.    and output it after the insn AFTER.  */
  958.  
  959. rtx
  960. emit_jump_insn_after (pattern, after)
  961.      register rtx pattern, after;
  962. {
  963.   register rtx insn = make_jump_insn_raw (pattern, 0);
  964.  
  965.   add_insn_after (insn, after);
  966.   return insn;
  967. }
  968.  
  969. /* Make an insn of code BARRIER
  970.    and output it after the insn AFTER.  */
  971.  
  972. rtx
  973. emit_barrier_after (after)
  974.      register rtx after;
  975. {
  976.   register rtx insn = rtx_alloc (BARRIER);
  977.  
  978.   INSN_UID (insn) = cur_insn_uid++;
  979.  
  980.   add_insn_after (insn, after);
  981.   return insn;
  982. }
  983.  
  984. /* Emit the label LABEL after the insn AFTER.  */
  985.  
  986. void
  987. emit_label_after (label, after)
  988.      rtx label, after;
  989. {
  990.   /* This can be called twice for the same label
  991.      as a result of the confusion that follows a syntax error!
  992.      So make it harmless.  */
  993.   if (INSN_UID (label) == 0)
  994.     {
  995.       INSN_UID (label) = cur_insn_uid++;
  996.       add_insn_after (label, after);
  997.     }
  998. }
  999.  
  1000. /* Emit a note of subtype SUBTYPE after the insn AFTER.  */
  1001.  
  1002. void
  1003. emit_note_after (subtype, after)
  1004.      int subtype;
  1005.      rtx after;
  1006. {
  1007.   register rtx note = rtx_alloc (NOTE);
  1008.   INSN_UID (note) = cur_insn_uid++;
  1009.   XSTR (note, 3) = 0;
  1010.   XINT (note, 4) = subtype;
  1011.   add_insn_after (note, after);
  1012. }
  1013.  
  1014. /* Make an insn of code INSN with pattern PATTERN
  1015.    and add it to the end of the doubly-linked list.
  1016.    If PATTERN is a SEQUENCE, take the elements of it
  1017.    and emit an insn for each element.
  1018.  
  1019.    Returns the last insn emitted.  */
  1020.  
  1021. rtx
  1022. emit_insn (pattern)
  1023.      rtx pattern;
  1024. {
  1025.   rtx insn;
  1026.  
  1027.   if (GET_CODE (pattern) == SEQUENCE)
  1028.     {
  1029.       register int i;
  1030.       /* For an empty sequence, emit nothing.  */
  1031.       if (XVEC (pattern, 0))
  1032.     for (i = 0; i < XVECLEN (pattern, 0); i++)
  1033.       add_insn (insn = XVECEXP (pattern, 0, i));
  1034.     }
  1035.   else
  1036.     {
  1037.       insn = make_insn_raw (pattern, NULL);
  1038.       add_insn (insn);
  1039.     }
  1040.   return insn;
  1041. }
  1042.  
  1043. /* Make an insn of code JUMP_INSN with pattern PATTERN
  1044.    and add it to the end of the doubly-linked list.  */
  1045.  
  1046. rtx
  1047. emit_jump_insn (pattern)
  1048.      rtx pattern;
  1049. {
  1050.   if (GET_CODE (pattern) == SEQUENCE)
  1051.     return emit_insn (pattern);
  1052.   else
  1053.     {
  1054.       register rtx insn = make_jump_insn_raw (pattern, NULL);
  1055.       add_insn (insn);
  1056.       return insn;
  1057.     }
  1058. }
  1059.  
  1060. /* Make an insn of code CALL_INSN with pattern PATTERN
  1061.    and add it to the end of the doubly-linked list.  */
  1062.  
  1063. rtx
  1064. emit_call_insn (pattern)
  1065.      rtx pattern;
  1066. {
  1067.   if (GET_CODE (pattern) == SEQUENCE)
  1068.     return emit_insn (pattern);
  1069.   else
  1070.     {
  1071.       register rtx insn = make_insn_raw (pattern, NULL);
  1072.       add_insn (insn);
  1073.       PUT_CODE (insn, CALL_INSN);
  1074.       return insn;
  1075.     }
  1076. }
  1077.  
  1078. /* Add the label LABEL to the end of the doubly-linked list.  */
  1079.  
  1080. void
  1081. emit_label (label)
  1082.      rtx label;
  1083. {
  1084.   /* This can be called twice for the same label
  1085.      as a result of the confusion that follows a syntax error!
  1086.      So make it harmless.  */
  1087.   if (INSN_UID (label) == 0)
  1088.     {
  1089.       INSN_UID (label) = cur_insn_uid++;
  1090.       add_insn (label);
  1091.     }
  1092. }
  1093.  
  1094. /* Make an insn of code BARRIER
  1095.    and add it to the end of the doubly-linked list.  */
  1096.  
  1097. void
  1098. emit_barrier ()
  1099. {
  1100.   register rtx barrier = rtx_alloc (BARRIER);
  1101.   INSN_UID (barrier) = cur_insn_uid++;
  1102.   add_insn (barrier);
  1103. }
  1104.  
  1105. /* Make an insn of code NOTE
  1106.    with data-fields specified by FILE and LINE
  1107.    and add it to the end of the doubly-linked list.  */
  1108.  
  1109. rtx
  1110. emit_note (file, line)
  1111.      char *file;
  1112.      int line;
  1113. {
  1114.   register rtx note;
  1115.  
  1116.   if (no_line_numbers && line > 0)
  1117.     return 0;
  1118.  
  1119.   if (line > 0)
  1120.     {
  1121.       if (file && last_filename && !strcmp (file, last_filename)
  1122.       && line == last_linenum)
  1123.     return 0;
  1124.       last_filename = file;
  1125.       last_linenum = line;
  1126.     }
  1127.  
  1128.   note = rtx_alloc (NOTE);
  1129.   INSN_UID (note) = cur_insn_uid++;
  1130.   XSTR (note, 3) = file;
  1131.   XINT (note, 4) = line;
  1132.   add_insn (note);
  1133.   return note;
  1134. }
  1135.  
  1136. /* Return an indication of which type of insn should have X as a body.
  1137.    The value is CODE_LABEL, INSN, CALL_INSN or JUMP_INSN.  */
  1138.  
  1139. enum rtx_code
  1140. classify_insn (x)
  1141.      rtx x;
  1142. {
  1143.   if (GET_CODE (x) == CODE_LABEL)
  1144.     return CODE_LABEL;
  1145.   if (GET_CODE (x) == CALL)
  1146.     return CALL_INSN;
  1147.   if (GET_CODE (x) == RETURN)
  1148.     return JUMP_INSN;
  1149.   if (GET_CODE (x) == SET)
  1150.     {
  1151.       if (SET_DEST (x) == pc_rtx)
  1152.     return JUMP_INSN;
  1153.       else if (GET_CODE (SET_SRC (x)) == CALL)
  1154.     return CALL_INSN;
  1155.       else
  1156.     return INSN;
  1157.     }
  1158.   if (GET_CODE (x) == PARALLEL)
  1159.     {
  1160.       register int j;
  1161.       for (j = XVECLEN (x, 0) - 1; j >= 0; j--)
  1162.     if (GET_CODE (XVECEXP (x, 0, j)) == CALL)
  1163.       return CALL_INSN;
  1164.     else if (GET_CODE (XVECEXP (x, 0, j)) == SET
  1165.          && SET_DEST (XVECEXP (x, 0, j)) == pc_rtx)
  1166.       return JUMP_INSN;
  1167.     else if (GET_CODE (XVECEXP (x, 0, j)) == SET
  1168.          && GET_CODE (SET_SRC (XVECEXP (x, 0, j))) == CALL)
  1169.       return CALL_INSN;
  1170.     }
  1171.   return INSN;
  1172. }
  1173.  
  1174. /* Emit the rtl pattern X as an appropriate kind of insn.
  1175.    If X is a label, it is simply added into the insn chain.  */
  1176.  
  1177. rtx
  1178. emit (x)
  1179.      rtx x;
  1180. {
  1181.   enum rtx_code code = classify_insn (x);
  1182.  
  1183.   if (code == CODE_LABEL)
  1184.     emit_label (x);
  1185.   else if (code == INSN)
  1186.     emit_insn (x);
  1187.   else if (code == JUMP_INSN)
  1188.     {
  1189.       emit_jump_insn (x);
  1190.       if (simplejump_p (x) || GET_CODE (x) == RETURN)
  1191.     emit_barrier ();
  1192.     }
  1193.   else if (code == CALL_INSN)
  1194.     emit_call_insn (x);
  1195. }
  1196.  
  1197. /* Generate a SEQUENCE rtx containing the insn-patterns in VEC
  1198.    following any insns previously placed on sequence_first_insn.
  1199.    This is how the gen_... function from a DEFINE_EXPAND
  1200.    constructs the SEQUENCE that it returns.  */
  1201.  
  1202. rtx
  1203. gen_sequence ()
  1204. {
  1205.   rtx tem;
  1206.   rtvec newvec;
  1207.   int i;
  1208.   int len;
  1209.  
  1210.   /* Count the insns in the chain.  */
  1211.   len = 0;
  1212.   for (tem = sequence_first_insn; tem; tem = NEXT_INSN (tem))
  1213.     len++;
  1214.  
  1215.   /* For an empty sequence... */
  1216.   if (len == 0)
  1217.     return gen_rtx (SEQUENCE, VOIDmode, NULL);
  1218.  
  1219.   /* If only one insn, return its pattern rather than a SEQUENCE.  */
  1220.   if (len == 1
  1221.       && (GET_CODE (sequence_first_insn) == INSN
  1222.       || GET_CODE (sequence_first_insn) == JUMP_INSN
  1223.       || GET_CODE (sequence_first_insn) == CALL_INSN))
  1224.     {
  1225.       tem = PATTERN (sequence_first_insn);
  1226.       sequence_first_insn = 0;
  1227.       sequence_last_insn = 0;
  1228.       return tem;
  1229.     }
  1230.  
  1231.   /* Put them in a vector.  */
  1232.   newvec = rtvec_alloc (len);
  1233.   i = 0;
  1234.   for (tem = sequence_first_insn; tem; tem = NEXT_INSN (tem), i++)
  1235.     newvec->elem[i].rtx = tem;
  1236.  
  1237.   /* Clear the chain and make a SEQUENCE from this vector.  */
  1238.   sequence_first_insn = 0;
  1239.   sequence_last_insn = 0;
  1240.   return gen_rtx (SEQUENCE, VOIDmode, newvec);
  1241. }
  1242.  
  1243. /* Set up regno_reg_rtx, reg_rtx_no and regno_pointer_flag
  1244.    according to the chain of insns starting with FIRST.
  1245.  
  1246.    Also set cur_insn_uid to exceed the largest uid in that chain.
  1247.  
  1248.    This is used when an inline function's rtl is saved
  1249.    and passed to rest_of_compilation later.  */
  1250.  
  1251. static void restore_reg_data_1 ();
  1252.  
  1253. void
  1254. restore_reg_data (first)
  1255.      rtx first;
  1256. {
  1257.   register rtx insn;
  1258.   int i;
  1259.   register int max_uid = 0;
  1260.  
  1261.   for (insn = first; insn; insn = NEXT_INSN (insn))
  1262.     {
  1263.       if (INSN_UID (insn) >= max_uid)
  1264.     max_uid = INSN_UID (insn);
  1265.  
  1266.       switch (GET_CODE (insn))
  1267.     {
  1268.     case NOTE:
  1269.     case CODE_LABEL:
  1270.     case BARRIER:
  1271.       break;
  1272.  
  1273.     case JUMP_INSN:
  1274.     case CALL_INSN:
  1275.     case INSN:
  1276.       restore_reg_data_1 (PATTERN (insn));
  1277.       break;
  1278.     }
  1279.     }
  1280.  
  1281.   /* Don't duplicate the uids already in use.  */
  1282.   cur_insn_uid = max_uid + 1;
  1283.  
  1284.   /* If any regs are missing, make them up.  */
  1285.   for (i = FIRST_PSEUDO_REGISTER; i < reg_rtx_no; i++)
  1286.     if (regno_reg_rtx[i] == 0)
  1287.       regno_reg_rtx[i] = gen_rtx (REG, SImode, i);
  1288. }
  1289.  
  1290. static void
  1291. restore_reg_data_1 (orig)
  1292.      rtx orig;
  1293. {
  1294.   register rtx x = orig;
  1295.   register int i;
  1296.   register enum rtx_code code;
  1297.   register char *format_ptr;
  1298.  
  1299.   code = GET_CODE (x);
  1300.  
  1301.   switch (code)
  1302.     {
  1303.     case QUEUED:
  1304.     case CONST_INT:
  1305.     case CONST_DOUBLE:
  1306.     case SYMBOL_REF:
  1307.     case CODE_LABEL:
  1308.     case PC:
  1309.     case CC0:
  1310.     case LABEL_REF:
  1311.       return;
  1312.  
  1313.     case REG:
  1314.       if (REGNO (x) >= FIRST_PSEUDO_REGISTER)
  1315.     {
  1316.       /* Make sure regno_pointer_flag and regno_reg_rtx are large
  1317.          enough to have an element for this pseudo reg number.  */
  1318.       if (REGNO (x) >= reg_rtx_no)
  1319.         {
  1320.           reg_rtx_no = REGNO (x);
  1321.  
  1322.           if (reg_rtx_no == regno_pointer_flag_length)
  1323.         {
  1324.           rtx *new1;
  1325.           char *new =
  1326.             (char *) oballoc (regno_pointer_flag_length * 2);
  1327.           bzero (new, regno_pointer_flag_length * 2);
  1328.           bcopy (regno_pointer_flag, new, regno_pointer_flag_length);
  1329.           regno_pointer_flag = new;
  1330.  
  1331.           new1 = (rtx *) oballoc (regno_pointer_flag_length * 2 * sizeof (rtx));
  1332.           bzero (new1, regno_pointer_flag_length * 2 * sizeof (rtx));
  1333.           bcopy (regno_reg_rtx, new1, regno_pointer_flag_length * sizeof (rtx));
  1334.           regno_reg_rtx = new1;
  1335.  
  1336.           regno_pointer_flag_length *= 2;
  1337.         }
  1338.           reg_rtx_no ++;
  1339.         }
  1340.       regno_reg_rtx[REGNO (x)] = x;
  1341.     }
  1342.       return;
  1343.  
  1344.     case MEM:
  1345.       restore_reg_data_1 (XEXP (x, 0));
  1346.       return;
  1347.     }
  1348.  
  1349.   /* Now scan the subexpressions recursively.  */
  1350.  
  1351.   format_ptr = GET_RTX_FORMAT (code);
  1352.  
  1353.   for (i = 0; i < GET_RTX_LENGTH (code); i++)
  1354.     {
  1355.       switch (*format_ptr++)
  1356.     {
  1357.     case 'e':
  1358.       restore_reg_data_1 (XEXP (x, i));
  1359.       break;
  1360.  
  1361.     case 'E':
  1362.       if (XVEC (x, i) != NULL)
  1363.         {
  1364.           register int j;
  1365.  
  1366.           for (j = 0; j < XVECLEN (x, i); j++)
  1367.         restore_reg_data_1 (XVECEXP (x, i, j));
  1368.         }
  1369.       break;
  1370.     }
  1371.     }
  1372. }
  1373.  
  1374. /* Initialize data structures and variables in this file
  1375.    before generating rtl for each function.
  1376.    WRITE_SYMBOLS is nonzero if any kind of debugging info
  1377.    is to be generated.  */
  1378.  
  1379. void
  1380. init_emit (write_symbols)
  1381.      int write_symbols;
  1382. {
  1383.   first_insn = NULL;
  1384.   last_insn = NULL;
  1385.   cur_insn_uid = 1;
  1386.   reg_rtx_no = FIRST_PSEUDO_REGISTER;
  1387.   last_linenum = 0;
  1388.   last_filename = 0;
  1389.   real_constant_chain = 0;
  1390.   first_label_num = label_num;
  1391.   sequence_first_insn = NULL;
  1392.   sequence_last_insn = NULL;
  1393.   emit_to_sequence = 0;
  1394.  
  1395.   no_line_numbers = ! write_symbols;
  1396.   
  1397.   /* Init the tables that describe all the pseudo regs.  */
  1398.  
  1399.   regno_pointer_flag_length = 100;
  1400.  
  1401.   regno_pointer_flag 
  1402.     = (char *) oballoc (regno_pointer_flag_length);
  1403.   bzero (regno_pointer_flag, regno_pointer_flag_length);
  1404.  
  1405.   regno_reg_rtx 
  1406.     = (rtx *) oballoc (regno_pointer_flag_length * sizeof (rtx));
  1407.   bzero (regno_reg_rtx, regno_pointer_flag_length * sizeof (rtx));
  1408. }
  1409.  
  1410. /* Create some permanent unique rtl objects shared between all functions.  */
  1411.  
  1412. void
  1413. init_emit_once ()
  1414. {
  1415.   /* Create the unique rtx's for certain rtx codes and operand values.  */
  1416.  
  1417.   pc_rtx = gen_rtx (PC, VOIDmode);
  1418.   cc0_rtx = gen_rtx (CC0, VOIDmode);
  1419.  
  1420.   /* Don't use gen_rtx here since gen_rtx in this case
  1421.      tries to use these variables.  */
  1422.   const0_rtx = rtx_alloc (CONST_INT);
  1423.   INTVAL (const0_rtx) = 0;
  1424.   const1_rtx = rtx_alloc (CONST_INT);
  1425.   INTVAL (const1_rtx) = 1;
  1426.  
  1427.   fconst0_rtx = rtx_alloc (CONST_DOUBLE);
  1428.   {
  1429.     union { double d; int i[2]; } u;
  1430.     u.d = 0;
  1431.     XINT (fconst0_rtx, 0) = u.i[0];
  1432.     XINT (fconst0_rtx, 1) = u.i[1];
  1433.     XEXP (fconst0_rtx, 2) = const0_rtx;
  1434.   }
  1435.   PUT_MODE (fconst0_rtx, SFmode);
  1436.  
  1437.   dconst0_rtx = rtx_alloc (CONST_DOUBLE);
  1438.   {
  1439.     union { double d; int i[2]; } u;
  1440.     u.d = 0;
  1441.     XINT (dconst0_rtx, 0) = u.i[0];
  1442.     XINT (dconst0_rtx, 1) = u.i[1];
  1443.     XEXP (dconst0_rtx, 2) = const0_rtx;
  1444.   }
  1445.   PUT_MODE (dconst0_rtx, DFmode);
  1446.  
  1447.   stack_pointer_rtx = gen_rtx (REG, Pmode, STACK_POINTER_REGNUM);
  1448.   frame_pointer_rtx = gen_rtx (REG, Pmode, FRAME_POINTER_REGNUM);
  1449. #ifdef STRUCT_VALUE
  1450.   struct_value_rtx = STRUCT_VALUE;
  1451. #else
  1452.   struct_value_rtx = gen_rtx (REG, Pmode, STRUCT_VALUE_REGNUM);
  1453. #endif
  1454.  
  1455. #ifdef STRUCT_VALUE_INCOMING
  1456.   struct_value_incoming_rtx = STRUCT_VALUE_INCOMING;
  1457. #else
  1458. #ifdef STRUCT_VALUE_INCOMING_REGNUM
  1459.   struct_value_incoming_rtx
  1460.     = gen_rtx (REG, Pmode, STRUCT_VALUE_INCOMING_REGNUM);
  1461. #else
  1462.   struct_value_incoming_rtx = struct_value_rtx;
  1463. #endif
  1464. #endif
  1465.  
  1466.   static_chain_rtx = gen_rtx (REG, Pmode, STATIC_CHAIN_REGNUM);
  1467.  
  1468. #ifdef STATIC_CHAIN_INCOMING_REGNUM
  1469.   if (STATIC_CHAIN_INCOMING_REGNUM != STATIC_CHAIN_REGNUM)
  1470.     static_chain_incoming_rtx = gen_rtx (REG, Pmode, STATIC_CHAIN_INCOMING_REGNUM);
  1471.   else
  1472. #endif
  1473.     static_chain_incoming_rtx = static_chain_rtx;
  1474.  
  1475.   if (FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM)
  1476.     arg_pointer_rtx = frame_pointer_rtx;
  1477.   else
  1478.     arg_pointer_rtx = gen_rtx (REG, Pmode, ARG_POINTER_REGNUM);
  1479. }
  1480.